<?php
require_once ("./commun/ouvre_base.php");

// ~ $link = mysqli_connect($host, $userbase, $passwd,$db) or die('Impossible de se connecter : ' . mysql_error());
mysql_select_db ( $db ) or die ( 'Impossible de s&#233;lectionner la base de donn&#233;es' );
// ~ mysqli_select_db($link,$db) or die('Impossible de s&#233;lectionner la base de donn&#233;es');

if (isset ( $_POST ['id'] )) {
	$id = $_POST ['id'];
} else {
	$id = $_SESSION ['id'];
}

$today = getdate ();
$date = "$today[year]-$today[mon]-$today[mday]";
$localtime = localtime ();
$heure = "$localtime[2]:$localtime[1]:$localtime[0]";

$query_last_login = "UPDATE `$db`.`users` SET `date_last_login` = '$date',
		`hour_last_login` = '$heure' WHERE `users`.`last_name` ='" . strtoupper ( $id ) . "';";
// echo $query_last_login;
mysql_query ( $query_last_login ) or die ( "Impossible d'entrer last login" . mysql_error () );
// ~ mysqli_query($link,$query_last_login) or die ("Impossible d'entrer last login" . mysql_error());
?>
